package net.mingsoft.examine.enums;

public enum NoticeEnum {
    XTTZ(1, "系统通知"),
    DX(2, "短信"),
    YX(3, "邮箱");


    private Integer code;
    private String description;

    NoticeEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static Integer getCode(String description) {
        for (NoticeEnum item : NoticeEnum.values()) {
            if (item.getDescription().equals(description)) {
                return item.getCode();
            }
        }
        return null;
    }

    public static String getDescription(Integer code) {
        if (code == null) {
            return null;
        }
        for (NoticeEnum item : NoticeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getDescription();
            }
        }
        return null;
    }


    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
